{
	initgraph(high, width);
	int a[10], b[10];
	int i,j;
	int v_x[10], v_y[10];
	for (i = 0; i < 10; i++)
	{
		v_x[i] = 1;
		v_y[i] = 1;
	}
	for (i = 0; i < 10; i++)
	{
		a[i] = rand() % (high - 20) + 20;
		b[i] = rand() % (width - 20) + 20;
	}
	while (1)
	{
		for (i = 0; i < 10; i++)
		{
			a[i] += v_x[i];
			b[i] += v_y[i];
			if (a[i]-20 <= 0 ||a[i]+20>=high)
			{		
				v_x[i] = -v_x[i];
				//a[i] += v_x[i];
			}
			 if (b[i]-20 <= 0 || b[i]+20>= width)
			{
				v_y[i] = -v_y[i];
				//b[i] += v_y[i];
			}
			 for (j = 0; j < 10;j++)
			 {
				 if (a[i]+20== a[j] || a[i]-20 == a[j])
				 {
					 v_x[i] = -v_x[i];
				 }
				 if (b[i]  +20== b[j] || b[i]-20 == b[j])
				 {
					 v_y[i] = -v_y[i];
					 //b[i] += v_y[i];
				 }
			 }
		}
		
		for (i = 0; i < 10; i++)
		{
			setcolor(BLACK);
			setfillcolor(YELLOW);
			fillcircle(a[i], b[i], 20);
			Sleep(1);
		}
		for (i = 0; i < 10; i++)
		{
			
			setfillcolor(BLACK);
			fillcircle(a[i], b[i], 20);
		}
	}
	getch();
	closegraph();
}